package com.yunfangdata.service.impl;




import com.yunfangdata.domain.SystemLog;
import com.yunfangdata.mapper.SystemLogMapper;
import com.yunfangdata.query.QueryObject;
import com.yunfangdata.service.ISystemLogService;
import com.yunfangdata.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class SystemLogServiceImpl implements ISystemLogService {

    @Autowired
    private SystemLogMapper mapper;

    public void save(SystemLog entity) {
        mapper.insert(entity);
    }

    public void delete(Long id) {
        mapper.deleteByPrimaryKey(id);
    }

    public void update(SystemLog entity) {

        mapper.updateByPrimaryKey(entity);
    }

    public SystemLog get(Long id) {
        return mapper.selectByPrimaryKey(id);
    }

    public List<SystemLog> list() {
        return mapper.selectAll();
    }

    public PageResult query(QueryObject qo) {
        int total = mapper.queryForCount(qo);

        if (total == 0){
            return new PageResult();
        }
        List<SystemLog> rows = mapper.queryForList(qo);

        return new PageResult(total,rows);
    }
}
